<!DOCTYPE HTML>
<html>
<head>
  <meta charset="utf-8" />
  <title>简单透明度渐变</title>
</head>
<style type="text/css">
  *{margin:0;padding:0;}
  #oDiv{width:200px;height:200px;margin:0 auto;background:#FF0004;}
</style>
<body>
<div id="oDiv">Lee</div>
</body>
<script type="text/javascript">
  window.onload = function(){
    var timer = setInterval(colorLiner,20);
    var val = 0;
    function colorLiner(){
      if(val <= 100){
        var oDiv = document.getElementById('oDiv');
        oDiv.style.opacity = val/100;
        val++;
      }
    }
  }
</script>
</html>
